; Music of Skate Crazy (1988) (Gremlin Graphics) (Ben Daglish)
; Ripped by Megachur the 15/12/2006

	write "SKATECRA.BIN"

music_date_rip	equ &0fc6
music_adr	equ &6a9a
first_theme	equ 0
last_theme	equ 1

	read "music_header_v1_0.asm"

;6a9a

	jp l6b2a	; init music
	jp l6bb2	; play music
.l6aa0
.music_end
	db #00
	jp l6aab	; sound fx
;
.stop_music
;
	xor a
	ld (l6aa0),a
	jp l7403
.l6aab
	di
	ld l,a
	ld e,a
	ld h,#00
	ld d,h
	add hl,hl
	add hl,de
	add hl,hl
	add hl,hl
	add hl,de
	ld iy,l7347
	ex de,hl
	add iy,de
	ld l,(iy+#0a)
	ld h,(iy+#0b)
	ld c,(iy+#0c)
	ld ix,l7348
	call l737f
	set 7,(ix+#11)
	ei
	ret
.l6ada equ $ + 7
.l6ad4 equ $ + 1
.l6ad3
	db #00,#00,#00,#00,#00,#00,#00,#00
.l6ae2 equ $ + 7
.l6ae0 equ $ + 5
.l6adf equ $ + 4
.l6ade equ $ + 3
.l6add equ $ + 2
.l6adc equ $ + 1
	db #00,#00,#00,#00,#00,#00,#00,#00
.l6ae9 equ $ + 6
.l6ae8 equ $ + 5
	db #00,#00,#00,#00,#00,#08,#00,#00
.l6af2 equ $ + 7
.l6af1 equ $ + 6
.l6aef equ $ + 4
	db #00,#00,#00,#00,#00,#00,#00,#00
.l6af7 equ $ + 4
.l6af5 equ $ + 2
.l6af4 equ $ + 1
.l6af3
	db #00,#00,#00,#00,#00,#00,#00,#00
.l6afe equ $ + 3
.l6afd equ $ + 2
	db #00,#00,#10,#00,#00,#00,#00,#00
.l6b0a equ $ + 7
.l6b09 equ $ + 6
.l6b08 equ $ + 5
.l6b07 equ $ + 4
.l6b06 equ $ + 3
.l6b04 equ $ + 1
	db #00,#00,#00,#00,#00,#00,#00,#00
.l6b12 equ $ + 7
.l6b0c equ $ + 1
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00
;
.init_music
.l6b2a
;
	push af
	call l7403
	pop af
	ld l,a
	add a
	add l
	add a
	ld hl,l7216
	add l
	ld l,a
	jr nc,l6b3b
	inc h
.l6b3b
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ld (l6ad4),de
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ld (l6ae9),de
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ld (l6afe),de
	xor a
	ld (l6add),a
	ld (l6af2),a
	ld (l6b07),a
	ld (l6ae2),a
	ld (l6af7),a
	ld (l6b0c),a
	cpl
	ld (l6ade),a
	ld (l6af3),a
	ld (l6b08),a
	ld a,#01
	ld (l6adc),a
	ld (l6af1),a
	ld (l6b06),a
	ld (l6adf),a
	ld (l6af4),a
	ld (l6b09),a
	ld hl,l6b12
	ld bc,#030a
.l6b8a
	xor a
.l6b8b
	ld (hl),a
	inc hl
	add c
	ld (hl),a
	inc hl
	add c
	cp #50
	jr nz,l6b8b
	djnz l6b8a
	ld hl,l72c1
	ld (l6ada),hl
	ld (l6aef),hl
	ld (l6b04),hl
	ld a,#ff
	ld (l6ae0),a
	ld (l6af5),a
	ld (l6b0a),a
	ld (l6aa0),a
	ret
;
.play_music
.l6bb2
;
	call l742c
	ld a,(l6aa0)
	and a
	ret z
	ld a,(l6ae0)
	ld hl,l6af5
	or (hl)
	ld hl,l6b0a
	or (hl)
	ld (l6aa0),a
	jr nz,l6bdc
	xor a
	ld (l6aa0),a
	ld a,(l7347)
	and #3f
	cp #3f
	ret z
	ld a,#01
	ld (l6aa0),a
	ret
.l6bdc
	ld iy,l6ad3
	ld ix,l7348
	call l6bfa
	ld iy,l6ae8
	ld ix,l735a
	call l6bfa
	ld iy,l6afd
	ld ix,l736c
.l6bfa
	call l6d3b
	ld a,(iy+#0b)
	and a
	jr z,l6c7f
.l6c03
	dec (iy+#09)
	jr z,l6c1a
	ld a,(iy+#03)
	ld (iy+#05),a
	ld a,(iy+#04)
	ld (iy+#06),a
	ld (iy+#0b),#00
	jr l6c7f
.l6c1a
	ld (iy+#09),#01
	ld l,(iy+#01)
	ld h,(iy+#02)
.l6c24
	ld a,(hl)
	cp #80
.l6c27
	jr c,l6c5f
	cp #fe
	jr nz,l6c36
	inc hl
	ld a,(hl)
	ld (iy+#0a),a
	inc hl
	jp l6c24
.l6c36
	cp #ff
	jr nz,l6c3f
	xor a
	ld (iy+#0d),a
	ret
.l6c3f
	cp #c0
	jr nc,l6c4c
	and #1f
	ld (iy+#09),a
	inc hl
	jp l6c24
.l6c4c
	and #07
	add (iy+#00)
	ld de,l6b12
	add e
	ld e,a
	jr nc,l6c59
	inc d
.l6c59
	inc hl
	ldi
	jp l6c24
.l6c5f
	ld (iy+#0b),#00
	inc hl
	ld (iy+#01),l
	ld (iy+#02),h
	ld c,a
	ld b,#00
	ld hl,l71e8
	add hl,bc
	ld e,(hl)
	ld hl,l71ff
	add hl,bc
	ld d,(hl)
	ld (iy+#03),e
	ld (iy+#04),d
	jr l6c85
.l6c7f
	ld e,(iy+#05)
	ld d,(iy+#06)
.l6c85
	dec (iy+#0c)
	jr z,l6c97
	ld a,(de)
	cp #80
	call nc,l6d01
	ld (iy+#05),e
	ld (iy+#06),d
	ret
.l6c97
	ld a,(de)
	cp #80
	jr c,l6ca8
	call l6d01
	ld a,(iy+#0b)
	and a
	jr z,l6c97
	jp l6c03
.l6ca8
	cp #7f
	jr z,l6cf4
	cp #7e
	jr nz,l6cb9
	inc de
	ld a,(de)
	ld l,a
	inc de
	ld a,(de)
	ld h,a
	jp l6ccd
.l6cb9
	add (iy+#0a)
	add #0c
	ld (iy+#0e),a
	ld hl,l6dcb
	add a
	ld c,a
	ld b,#00
	add hl,bc
	ld a,(hl)
	inc hl
	ld h,(hl)
	ld l,a
.l6ccd
	ld a,(iy+#0f)
	or #c0
	ld (iy+#14),a
	inc de
	ld a,(de)
	inc de
	ld (iy+#0c),a
	ld c,a
	ld (iy+#05),e
	ld (iy+#06),d
	ld e,(iy+#07)
	ld a,(iy+#08)
	ld hy,a
	ld ly,e
	bit 7,(ix+#11)
	ret nz
	jp l737f
.l6cf4
	inc de
	ld a,(de)
	inc de
	ld (iy+#0c),a
	ld (iy+#05),e
	ld (iy+#06),d
	ret
.l6d01
	ld a,(de)
	cp #88
	jr nc,l6d1f
	and #07
	add (iy+#00)
	ld c,a
	ld b,#00
	ld hl,l6b12
	add hl,bc
	ld c,(hl)
	ld hl,l72c1
	add hl,bc
	ld (iy+#07),l
	ld (iy+#08),h
	inc de
	ret
.l6d1f
	cp #ff
	jr nz,l6d28
	ld (iy+#0b),#ff
	ret
.l6d28
	cp #c0
	jr nc,l6d33
	and #0f
	ld (iy+#0f),a
	inc de
	ret
.l6d33
	inc de
	cp #c2
	ret z
	inc de
	inc de
	inc de
	ret
.l6d3b
	bit 7,(ix+#11)
	ret nz
	ld a,(iy+#14)
	bit 7,a
	ret z
	and #3f
	jr nz,l6d4f
	res 7,(iy+#14)
	ret
.l6d4f
	ld d,#07
	bit 6,(iy+#14)
	jr nz,l6d83
	dec (iy+#12)
	ret nz
	dec (iy+#13)
	jp z,l6d83
	ld l,(iy+#10)
	ld h,(iy+#11)
	inc l
	ld (iy+#10),l
	jp nz,l6d72
	inc h
	ld (iy+#11),h
.l6d72
	ld a,(hl)
	and d
	ld (iy+#12),a
	ld a,(hl)
	rrca
	rrca
	rrca
	and #1f
	add (iy+#0e)
	jp l6db8
.l6d83
	ld hl,l6c27
	ld a,(iy+#14)
	add a
	add a
	add a
	ld e,a
	add hl,de
	bit 7,(hl)
	jr nz,l6d9d
	bit 6,(iy+#14)
	jr nz,l6d9d
	ld (iy+#13),#01
	ret
.l6d9d
	res 6,(iy+#14)
	ld a,(hl)
	rrca
	rrca
	rrca
	and d
	ld (iy+#12),a
	ld a,(hl)
	and d
	inc a
	ld (iy+#13),a
	ld (iy+#10),l
	ld (iy+#11),h
	ld a,(iy+#0e)
.l6db8
	add a
	ld hl,l6dcb
	add l
	ld l,a
	jr nc,l6dc1
	inc h
.l6dc1
	ld a,(hl)
	ld (ix+#03),a
	inc hl
	ld a,(hl)
	ld (ix+#04),a
	ret
.l6dcb
	dw #0eee,#0e18,#0d4d,#0c8e
	dw #0bda,#0b2f,#0a8f,#09f7
	dw #0968,#08e1,#0861,#07e9
	dw #0777,#070c,#06a7,#0647
	dw #05ed,#0598,#0547,#04fc
	dw #04d4,#0470,#0431,#03f4
	dw #03dc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #0018
	
	.l6e75
	db #81,#22,#05,#22,#05,#80,#3d,#05
	db #3d,#05,#82,#12,#05,#80,#3d,#05
	db #81,#22,#05,#80,#3d,#05,#3d,#05
	db #81,#22,#05,#22,#05,#22,#05,#82
	db #12,#05,#81,#22,#05,#22,#05,#22
.l6ea2 equ $ + 5
.l6e9f equ $ + 2
	db #05,#ff,#7f,#28,#ff,#83,#06,#05
	db #82,#12,#05,#12,#05,#12,#05,#12
	db #05,#12,#05,#12,#05,#12,#05,#ff
.l6eb9 equ $ + 4
.l6eb5
	db #83,#12,#14,#ff,#84,#06,#0a,#06
	db #0a,#0d,#0a,#06,#05,#0b,#0f,#06
	db #05,#09,#0a,#06,#05,#04,#0a,#06
	db #0a,#06,#0a,#0d,#0a,#06,#05,#0b
	db #0f,#06,#05,#09,#0a,#06,#05,#12
	db #0a,#06,#0a,#06,#0a,#0d,#0a,#06
	db #05,#0b,#0f,#06,#05,#09,#0a,#06
	db #05,#04,#0a,#04,#0a,#04,#0a,#0b
	db #0a,#04,#05,#09,#0f,#04,#05,#08
.l6f03 equ $ + 6
	db #0a,#04,#05,#10,#0a,#ff,#81,#22
	db #05,#22,#05,#80,#3d,#05,#3d,#05
	db #82,#12,#05,#80,#3d,#05,#81,#22
	db #05,#80,#3d,#05,#3d,#05,#82,#12
	db #05,#12,#05,#12,#05,#12,#05,#12
.l6f2b equ $ + 6
	db #05,#12,#05,#12,#05,#ff,#80,#92
	db #34,#50,#2f,#50,#90,#86,#1e,#0a
	db #25,#04,#7f,#01,#25,#09,#7f,#01
	db #25,#09,#7f,#01,#25,#04,#7f,#01
	db #28,#0a,#27,#0a,#25,#0a,#23,#0a
	db #1e,#0a,#25,#04,#7f,#01,#25,#09
	db #7f,#01,#25,#09,#7f,#01,#25,#04
	db #7f,#01,#28,#0a,#27,#0a,#25,#0a
.l6f68 equ $ + 3
	db #23,#0a,#ff,#80,#92,#36,#50,#34
	db #28,#2f,#28,#90,#86,#1e,#0a,#2a
	db #04,#7f,#01,#2a,#09,#7f,#01,#2a
	db #09,#7f,#01,#2a,#04,#7f,#01,#2d
	db #0a,#2c,#0a,#2a,#0a,#25,#0a,#23
	db #0a,#28,#04,#7f,#01,#28,#09,#7f
	db #01,#28,#09,#7f,#01,#28,#04,#7f
	db #01,#2c,#0a,#2a,#0a,#28,#0a,#25
.l6fa7 equ $ + 2
	db #0a,#ff,#87,#34,#05,#34,#05,#33
	db #0a,#34,#05,#34,#05,#33,#0a,#34
	db #05,#34,#05,#33,#05,#34,#0a,#36
	db #0f,#34,#0a,#34,#0a,#33,#05,#31
	db #05,#2f,#05,#31,#05,#7f,#14,#86
	db #25,#05,#28,#05,#2c,#05,#2f,#05
	db #87,#34,#05,#34,#05,#33,#0a,#34
	db #05,#34,#05,#33,#0a,#34,#05,#34
	db #05,#33,#05,#34,#0a,#36,#0f,#39
	db #0a,#39,#0a,#38,#05,#36,#05,#34
	db #05,#2f,#05,#7f,#14,#86,#23,#05
.l7004 equ $ + 7
	db #28,#05,#2a,#05,#2f,#05,#ff,#80
	db #3d,#05,#3d,#05,#3d,#05,#3d,#05
	db #82,#12,#05,#80,#3d,#05,#81,#22
	db #05,#80,#3d,#05,#3d,#05,#81,#22
	db #05,#22,#05,#22,#05,#82,#12,#05
	db #81,#22,#05,#80,#3d,#05,#3d,#05
	db #81,#22,#05,#80,#3d,#05,#81,#22
	db #05,#80,#3d,#05,#82,#12,#05,#80
	db #3d,#05,#81,#22,#05,#80,#3d,#05
	db #3d,#05,#81,#22,#05,#22,#05,#22
	db #05,#82,#12,#05,#81,#22,#05,#82
.l705a equ $ + 5
	db #12,#05,#12,#05,#ff,#84,#09,#0a
	db #15,#05,#09,#05,#15,#05,#09,#05
	db #15,#05,#0b,#0a,#0b,#05,#17,#05
	db #0b,#05,#17,#0a,#15,#05,#12,#05
.l7078 equ $ + 3
	db #7f,#50,#ff,#81,#36,#05,#36,#05
	db #2f,#0a,#83,#06,#0a,#81,#36,#05
	db #36,#05,#2f,#05,#7f,#0a,#36,#05
.l7094 equ $ + 7
	db #36,#05,#36,#05,#2f,#0a,#ff,#84
	db #09,#0a,#15,#05,#09,#05,#15,#05
	db #09,#05,#15,#05,#0b,#0a,#0b,#05
	db #17,#05,#0b,#05,#17,#0a,#15,#05
	db #12,#05,#91,#81,#2a,#50,#90,#ff
.l70b9 equ $ + 4
.l70b5
	db #84,#06,#14,#ff,#83,#06,#14,#82
.l70c0 equ $ + 3
	db #12,#14,#ff,#86,#28,#05,#29,#05
	db #2a,#05,#2d,#0a,#2a,#0a,#2f,#0a
	db #2a,#0a,#2f,#05,#30,#05,#2f,#05
	db #2d,#05,#2a,#05,#28,#05,#29,#05
	db #2a,#05,#2d,#0a,#2f,#05,#2d,#05
.l70e8 equ $ + 3
	db #2a,#2d,#ff,#86,#36,#05,#34,#05
	db #31,#05,#2f,#0a,#2d,#0a,#2f,#0a
	db #2a,#0a,#2f,#05,#30,#05,#2f,#05
	db #2d,#05,#2a,#05,#36,#05,#34,#05
	db #31,#05,#2f,#0a,#2d,#05,#2f,#05
.l7110 equ $ + 3
	db #2d,#2d,#ff,#84,#09,#0a,#09,#0a
	db #10,#0a,#09,#05,#0b,#0a,#0b,#0a
	db #0b,#05,#12,#0a,#10,#05,#0d,#05
	db #06,#0a,#06,#0a,#0d,#0a,#06,#05
	db #0b,#0f,#06,#05,#09,#0a,#06,#05
.l7138 equ $ + 3
	db #12,#0a,#ff,#87,#34,#05,#31,#0a
	db #34,#0a,#36,#0a,#39,#0a,#39,#05
	db #38,#05,#36,#05,#3b,#05,#39,#05
	db #36,#05,#34,#05,#86,#2f,#05,#30
	db #05,#31,#05,#34,#0a,#31,#0a,#2f
	db #0a,#2d,#05,#2a,#05,#28,#0a,#2a
.l7167 equ $ + 2
	db #0f,#ff,#87,#3d,#05,#3b,#0a,#39
	db #0a,#3d,#0a,#3b,#0a,#3b,#05,#39
	db #05,#36,#05,#38,#05,#39,#05,#38
	db #05,#36,#05,#86,#2f,#05,#30,#05
	db #31,#05,#34,#0a,#36,#0a,#3d,#0a
	db #3c,#05,#3b,#05,#39,#0a,#36,#0f
.l7196 equ $ + 1
	db #ff,#81,#36,#05,#36,#05,#36,#05
	db #33,#0a,#33,#0a,#33,#05,#2f,#23
	db #36,#0a,#36,#0a,#33,#0a,#33,#0a
.l71b2 equ $ + 5
	db #33,#05,#2f,#28,#ff,#81,#36,#05
	db #36,#05,#33,#14,#36,#05,#36,#05
	db #2f,#0f,#36,#05,#33,#0a,#2f,#05
.l71c8 equ $ + 3
	db #2f,#05,#ff,#81,#36,#05,#36,#05
	db #36,#05,#36,#05,#33,#05,#33,#05
	db #33,#05,#33,#05,#2f,#05,#2f,#05
	db #2f,#05,#2f,#05,#2c,#05,#2c,#05
	db #2c,#0a,#ff

.l71e8
	db l6e75,l6e9f,l6ea2,l6eb5
	db l6eb9,l6f03,l6f2b,l6f68
	db l6fa7,l7004,l705a,l7078
	db l7094,l70b5,l70b9,l70c0
	db l70e8,l7110,l7138,l7167
	db l7196,l71b2,l71c8
;	db #75,#9f,#a2,#b5,#b9,#03,#2b,#68
;	db #a7,#04,#5a,#78,#94,#b5,#b9,#c0
;	db #e8,#10,#38,#67,#96,#b2,#c8
.l71ff
	db l6e75/&100,l6e9f/&100,l6ea2/&100,l6eb5/&100
	db l6eb9/&100,l6f03/&100,l6f2b/&100,l6f68/&100
	db l6fa7/&100,l7004/&100,l705a/&100,l7078/&100
	db l7094/&100,l70b5/&100,l70b9/&100,l70c0/&100
	db l70e8/&100,l7110/&100,l7138/&100,l7167/&100
	db l7196/&100,l71b2/&100,l71c8/&100
;	db #6e,#6e,#6e,#6e,#6e,#6f,#6f,#6f
;	db #6f,#70,#70,#70,#70,#70,#70,#70
;	db #70,#71,#71,#71,#71,#71,#71
.l7216
	dw l7222,l723e,l726f
	dw l729e,l72af,l72b8
.l7222
	db #9e,#03,#02,#87,#00,#05,#87,#00
	db #05,#87,#00,#05,#87,#00,#05,#89
	db #09,#00,#05,#87,#00,#05,#87,#00
	db #05,#86,#09,#ff
.l723e
	db #fe,#fb,#8a,#04,#88,#01,#fe,#ef
	db #83,#0a,#c1,#5a,#0c,#fe,#fb,#8c
	db #0d,#fe,#fe,#0d,#0d,#fe,#00,#0d
	db #0d,#fe,#fb,#8c,#0d,#fe,#fe,#0d
	db #0d,#fe,#00,#0d,#0d,#fe,#fb,#04
	db #04,#84,#11,#90,#0e,#87,#0e,#02
	db #ff
.l726f
	db #fe,#fb,#c4,#32,#84,#04,#c0,#50
	db #fe,#07,#06,#06,#07,#07,#fe,#fb
	db #08,#08,#90,#03,#90,#03,#8c,#03
	db #c1,#64,#0b,#0f,#0f,#10,#10,#0f
	db #0f,#10,#10,#12,#12,#13,#13,#88
	db #01,#14,#14,#83,#15,#16,#ff
.l729e
	db #83,#09,#00,#05,#83,#09,#00,#05
	db #83,#09,#00,#05,#83,#09,#00,#05
	db #ff
.l72af
	db #90,#01,#90,#01,#90,#01,#90,#01
	db #ff
.l72b8
	db #90,#01,#90,#01,#90,#01,#90,#01
	db #ff
.l72c1
	db #7f,#e5,#01,#a6,#7f,#00,#00,#00
	db #00,#03,#7f,#e2,#01,#a6,#64,#00
	db #00,#00,#00,#02,#7f,#f7,#01,#a6
	db #7f,#00,#00,#2f,#00,#03,#7f,#f4
	db #01,#ff,#7f,#00,#00,#00,#02,#01
	db #50,#fc,#01,#ff,#7f,#00,#03,#09
	db #00,#01,#50,#fc,#01,#ff,#7f,#00
	db #82,#0c,#00,#01,#08,#ff,#01,#ff
	db #01,#07,#03,#03,#00,#05,#7f,#f8
	db #01,#ff,#7f,#00,#03,#03,#00,#01
	db #7f,#ff,#01,#ff,#7f,#00,#02,#02
	db #00,#01,#7f,#e2,#7f,#ff,#7f,#00
	db #00,#fd,#ff,#01,#7f,#fd,#01,#ff
	db #64,#00,#00,#0c,#00,#01,#8a,#19
	db #31,#00,#00,#00,#00,#00,#a9,#3d
	db #00,#00,#00,#00,#00,#00,#8a,#21
.l7348 equ $ + 7
.l7347 equ $ + 6
	db #39,#00,#00,#00,#00,#00,#3f,#fe
.l734d equ $ + 4
.l734c equ $ + 3
.l734b equ $ + 2
	db #f7,#09,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l735f equ $ + 6
.l735e equ $ + 5
.l735d equ $ + 4
.l735a equ $ + 1
.l7359
	db #00,#fd,#ef,#12,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l7370 equ $ + 7
.l736f equ $ + 6
.l736c equ $ + 3
.l736b equ $ + 2
	db #00,#00,#00,#fb,#df,#24,#00,#00
.l7371
	db #00,#00,#00,#00,#00,#00,#00,#00
.l737e equ $ + 5
.l737d equ $ + 4
	db #00,#00,#00,#00,#00,#00
.l737f
	ld a,ly
	ld (ix+#0f),a
	ld a,hy
	ld (ix+#10),a
	ld (ix+#03),l
	ld (ix+#04),h
	ld (ix+#06),c
	ld a,(iy+#05)
	ld (ix+#07),a
	ld a,(iy+#06)
	and #7f
	srl a
	jr nz,l73a3
	ld a,#01
.l73a3
	ld (ix+#08),a
	ld a,(iy+#07)
	ld (ix+#0b),a
	ld a,(iy+#08)
	ld (ix+#0c),a
	xor a
	ld (ix+#09),a
	ld (ix+#0a),a
	ld a,(l7347)
	or (ix+#02)
	ld c,(iy+#09)
	ld (ix+#11),c
	bit 0,c
	jr z,l73cc
	and (ix+#00)
.l73cc
	bit 1,c
	jr z,l73d3
	and (ix+#01)
.l73d3
	ld (l7347),a
	bit 2,c
	jr nz,l73e4
	ld hl,l751a
	ld (ix+#0d),l
	ld (ix+#0e),h
	ret
.l73e4
	call l75d2
	ld a,(iy+#00)
	ld c,#0d
	call l75e9
	ld a,(iy+#04)
	ld c,#0b
	call l75e9
	inc c
	xor a
	call l75e9
	ld (ix+#05),#ff
	jp l75de
.l7403
	call l75d2
	ld c,#07
	ld a,(l7347)
	or #3f
	ld (l7347),a
	call l75e9
	xor a
	inc c
	call l75e9
	inc c
	call l75e9
	inc c
	call l75e9
	ld (l7359),a
	ld (l736b),a
	ld (l737d),a
	jp l75de
.l742c
	ld a,(l7347)
	and #3f
	cp #3f
	ret z
	ld ix,l7348
	call l74e8
	ld ix,l735a
	call l74e8
	ld ix,l736c
	call l74e8
	call l75d2
	ld ix,l7348
	ld c,#07
	ld a,(l7347)
	call l75e9
	ld c,#00
	ld a,(l734b)
	add (ix+#09)
	bit 1,(ix+#11)
	jp z,l746a
	ld (l737e),a
.l746a
	call l75e9
	inc c
	ld a,(l734c)
	adc (ix+#0a)
	call l75e9
	inc c
	ld a,(l735d)
	add (ix+#1b)
	bit 1,(ix+#23)
	jp z,l7488
	ld (l737e),a
.l7488
	call l75e9
	inc c
	ld a,(l735e)
	adc (ix+#1c)
	call l75e9
	inc c
	ld a,(l736f)
	add (ix+#2d)
	bit 1,(ix+#35)
	jp z,l74a6
	ld (l737e),a
.l74a6
	call l75e9
	inc c
	ld a,(l7370)
	adc (ix+#2e)
	call l75e9
	inc c
	ld a,(l737e)
	rrca
	rrca
	rrca
	call l75e9
	ld c,#08
	ld a,(l734d)
	srl a
	srl a
	srl a
	call l75e9
	inc c
	ld a,(l735f)
	srl a
	srl a
	srl a
	call l75e9
	inc c
	ld a,(l7371)
	srl a
	srl a
	srl a
	call l75e9
	jp l75de
.l74e8
	ld a,(l7347)
	and (ix+#02)
	cp (ix+#02)
	ret z
	ld a,(ix+#0f)
	ld ly,a
	ld a,(ix+#10)
	ld hy,a
	ld a,(ix+#06)
	and a
	jr z,l7509
	cp #ff
	jr z,l7509
	dec (ix+#06)
.l7509
	call l7590
	bit 2,(iy+#09)
	jp nz,l7589
	ld l,(ix+#0d)
	ld h,(ix+#0e)
	jp (hl)
.l751a
	ld a,(ix+#05)
	add (iy+#00)
	cp (iy+#04)
	jr nc,l7529
	ld (ix+#05),a
	ret
.l7529
	ld a,(iy+#04)
	ld (ix+#05),a
	ld hl,l7539
	ld (ix+#0d),l
	ld (ix+#0e),h
	ret
.l7539
	ld a,(ix+#05)
	add (iy+#01)
	jp m,l754b
	cp (iy+#02)
	jr c,l754b
	ld (ix+#05),a
	ret
.l754b
	ld a,(iy+#02)
	ld (ix+#05),a
	ld hl,l755b
	ld (ix+#0d),l
	ld (ix+#0e),h
	ret
.l755b
	ld a,(ix+#06)
	and a
	ret nz
	ld hl,l756a
	ld (ix+#0d),l
	ld (ix+#0e),h
	ret
.l756a
	ld a,(ix+#05)
	add (iy+#03)
	jp m,l7577
	ld (ix+#05),a
	ret
.l7577
	ld (ix+#05),#00
	ld a,(l7347)
	or (ix+#02)
	ld (l7347),a
	res 7,(ix+#11)
	ret
.l7589
	ld a,(ix+#06)
	and a
	ret nz
	jr l7577
.l7590
	ld a,(ix+#07)
	and a
	jr z,l759d
	cp #ff
	ret z
	dec (ix+#07)
	ret nz
.l759d
	ld l,(ix+#09)
	ld h,(ix+#0a)
	ld c,(ix+#0b)
	ld b,(ix+#0c)
	add hl,bc
	ld (ix+#09),l
	ld (ix+#0a),h
	dec (ix+#08)
	ret nz
	ld a,(iy+#06)
	and a
	ret z
	jp p,l75c1
	ld (ix+#07),#ff
	ret
.l75c1
	ld (ix+#08),a
	ld a,c
	cpl
	ld c,a
	ld a,b
	cpl
	ld b,a
	inc bc
	ld (ix+#0b),c
	ld (ix+#0c),b
	ret
.l75d2
	ld bc,#f782
	out (c),c
	ld de,#c000
	ld hl,#f680
	ret
.l75de
	ld bc,#f40e
	out (c),c
	ld b,h
	out (c),d
	out (c),e
	ret
.l75e9
	ld b,#f4
	out (c),c
	ld b,h
	out (c),d
	out (c),e
	ld b,#f4
	out (c),a
	ld b,h
	out (c),l
	out (c),e
	ret
;	db #ab,#00,#00,#00,#00

;ld a,#00
;call #6a9a	; init
;call #6a9d	; play

;
.game_name
	db "Skate Crazy",0
.game_year
	db "1988",0
.game_publisher
	db "Gremlin Graphics",0
.music_author
	db "Ben Daglish",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
